package Lambda;

import javax.jws.soap.SOAPBinding;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by 旧 on 2018/8/9.
 */
public class AJ1 {
    static String h="你好！";
    public static void main(String[] args) {

        List<User>loopList=getLoopList();
        Map<Integer, Integer>map=new HashMap();
        for (int i = 0; i < 10; i++) {
            map.put(i,1);
        }
        /*loopList.forEach(System.out::println);
        map.forEach((k,v)->System.out.println("k:"+k+"v:"+v));
        loopList.forEach(user -> {
            user.lxk_+="猪";
            loopList.forEach(System.out::println);
        });*/
        map.forEach((k,v)->{
            v=v+10;
            map.put(k,v);
        });
        map.forEach((k,v)->System.out.println("k:"+k+"v:"+v));

    }
    private static List<User> getLoopList(){
        List<User> all=new ArrayList<>();
        for (int i = 0; i <10 ; i++) {
            all.add(new User("lxk_","pwd"+i));
        }
        return all;
    }



    public  interface  Convert<T1,T2>{
        void convert(int i);

    }


    public static int operate(int a,int b,MathOperation mathOperation){
        return mathOperation.operation(a,b);
    }

    interface  MathOperation{
        int operation(int a,int b);
    }
    interface  GreetingService{
        void operation(String message);
    }
}
/*
*        final  int num=9;
        Convert<Integer,String> s=(paiam)->
                System.out.println(Integer.valueOf(paiam)+num);
        s.convert(9);
*
        //通过lamdbda匿名函数重写抽样方法  里氏代换
        MathOperation add=(int a,int b) -> a+b;
        MathOperation sub=(a,b) -> a+b;
        //大括号中的返回语句
        MathOperation multiplication=(int a,int b) -> {return a*b;};
        //没有大括号及返回语句
        MathOperation division=(int a,int b) -> a/b;

        System.out.println("10 + 5="+operate(10,5,add));



        GreetingService greet1=message ->
                System.out.println("hello"+message+h);
        GreetingService greet2=message ->{
            System.out.println("hello"+message+h);
        };
          greet1.operation("一");
        greet2.operation("二");


* */